<?php
/**
 * Manageaccount_Model_Updatuserprivatedata
 * update user private data
 * @author Adrian Stolarski
 */
class Manageaccount_Model_Updateuserprivatedata implements Manageaccount_Model_Mainable, 
        Manageaccount_Model_Redirectable {
    
    /**
     *
     * @var type $action_handler
     * action handler
     */
    public $action_handler;
    
    /**
     * main()
     * update user company data
     * 
     * @param array $variables
     */
    public function main(array $variables = null) {
        if(isset($variables['csrf_token']) && ($variables['csrf_token'] = $_SESSION['csrf_token'])){
            //var_dump($variables);
            // die();
            $this->action_handler = new Manageaccount_Data_Updateuserprivatedata;
            $this->action_handler->main($variables);
        }
        else {
            $this->redirect_action($variables);
        }
    }
    
    /**
     * redirect_action()
     * login redirect
     * 
     * @param array $variables
     */
    public function redirect_action(array $variables = null) {
        session_destroy();
        $this->action_handler = new Login_Data_Loginredirect;
        $this->action_handler->main($variables);
    }

}
